
var pgpromise = require( 'pg-promise' )()

const pgConfig = {
    user: 'postgres',
    password: '123456',
    database: 'postgres',                                                                                   
    host: '127.0.0.1',
    port: '5432',
    poolSize: 5,
}   


async function main () { 
	var db = pgpromise( pgConfig )
    console.log( db )
	return await db.any( 'insert into protector_op_log( stamp, op, arm_area_idx, mac )   VALUES( $1::timestamp, $2, $3, $4 ) ', [ Date.now(), "alarm" , 1, '112233445566' ] );
}

main().then(function(data ){
    console.log( "success select : ")
	console.log( data );
}).catch(function( data ){ 
    console.log( "error: ", data )
})
